{% extends "template.html" %}
{% load blog_extras %}

{% block title %}
	没有比人更高的山——日志
{% endblock %}

{% block sidebar %}
	<h1>Catagories</h1>
	<div class="left-box">
		<ul class="sidemenu">
			{% for catagory in catagories %}				
			<li><a href="/blog/catagory/{{catagory.id}}/">{{catagory.name}}({{catagory.diarys.all|length}})</a></li>
			{% endfor %}
		</ul>	
	</div>
	
	<h1>Tags</h1>
	<div class="left-box">
		<ul class="sidemenu">
			{% for tag in tags %}
			<li><a href="/blog/tag/{{tag.id}}/">{{tag.name}}({{tag.diarys.all|length}})</a></li>
			{% endfor %}
		</ul>
	</div>

{% endblock %}

{% block main %}
	<a href="/blog/diary/{{diary.id}}/"><h1>{{diary.title}}</h1></a>
	<p>{% autoescape off %}{{diary.content}}{% endautoescape %}</p>
	<div class="post-footer align-left">
		<div style="float:left;">
		标签：
		{% for tag in diary.tags.all %}
			<a href="/blog/tag/{{tag.id}}">{{tag.name}} </a> {% if not forloop.last %} | {% endif %}
		{% endfor %}
		</div>
		<div style="float:right;">
		<a href="/blog/diary/{{diary.id}}/" class="readmore">Read more</a>
		<a href="/blog/diary/{{diary.id}}/#comment" class="comments">Comments ({{diary.comments.all|length}})</a>
		<span class="date">{{diary.post_time|date:"Y-m-d H:i"}}</span>
		</div>
		<div style="clear:both;"></div>
	</div>
	<div style="clear:both;"></div>
	<div id="comments" >
		<a name="comment"></a>
		<label>评论</label>
		{% for comment in diary.comments.all%}
		<div class="comment">
			<div class="comment_head"><a href="mailto:{{comment.email}}">{{comment.author}}</a> 发表于 <span class="date">{{comment.post_time|date:"Y-m-d H:i"}}</span></div>
			<p>{{comment.content}}</p>
		</div>
		{% endfor %}
		<p>
			<label>Name</label>
			<input id="author" value="Your Name" type="text" size="30" />
			<label>Email</label>
			<input id="email" value="Your Email" type="text" size="30" />
			<label>Your Comments</label>
			<textarea id="content" rows="5" cols="5"></textarea>
			<br />	
			<input class="button" type="button" value="提交评论" onclick="javascrip:save_comment({{diary.id}})"/>
			<input class="button" type="button" value="返回" onclick="javascript:history.go(-1);"/>
		</p>
	</div>
{% endblock %}